﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.Bll;

namespace Acms.AcmsControls.ContentControls.Admin
{
    public class HtmlAdminDisplay : BaseAdminDisplay<HtmlContentControlProperties>
    {
        protected override string GetCssClass
        {
            get { return "html"; }
        }

        public override void PropertiesLoaded(HtmlContentControlProperties properties)
        {
            if (properties != null)
            {
                this.Html = properties.GetHtml();
            }
        }


        public override void DataBind()
        {
        }

        public string Html { get; set; }

        protected override object SaveViewState()
        {
            ViewState["Html"] = Html;
            return base.SaveViewState();
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
            Html = ViewState["Html"] as string;
        }

        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.Write(Html);
            base.RenderContents(writer);
        }
    }
}
